package com.chatplus.application.web.security;


import com.chatplus.application.common.crypto.PBKDF2PasswordHasher;

/**
 * C# .net PBKDF2密码哈希算法Encoder
 */
public class DotNetPBKDF2PasswordEncoder implements CompatiblePasswordEncoder {

    @Override
    public String encode(CharSequence rawPassword) {
        return PBKDF2PasswordHasher.hashPassword(rawPassword.toString());
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return PBKDF2PasswordHasher.verifyHashedPassword(encodedPassword, rawPassword.toString());
    }

    @Override
    public boolean isSupport(String encodedPassword) {
        return PBKDF2PasswordHasher.isSupport(encodedPassword);
    }
}
